require 'View.Base.BehaviourView'

UIImageOuterMask = class("UIImageOuterMask", BehaviourView)

function UIImageOuterMask:Awake(obj)
    BehaviourView.Awake(self, obj)
    self.component = obj:GetComponent('Image')
    self.material = obj:GetComponent('Image').material
end

function UIImageOuterMask:SetCenter(screenCenter)
    if self.material then
        self.material:SetFloat('_CenterX',screenCenter.x / UnityEngine.Screen.width )
        self.material:SetFloat('_CenterY',1 - screenCenter.y / UnityEngine.Screen.height)
    end
end

function UIImageOuterMask:SetSize(size)
    if self.material then
        self.material:SetFloat('_Width',size.x / VIEWM.CanvasSize.x)
        self.material:SetFloat('_Height',size.y / VIEWM.CanvasSize.y)
    end
end